const http = require("http");
const portMaps = require('./data.js')
const PORT = 4000;
http
  .createServer(function ({ method, url }, res) {

    const newUrl = url.split('?')[0]
    res.writeHead(200, { 'Content-Type': 'application/json' });
    res.end(
      JSON.stringify(portMaps[`${method} /api${newUrl}`])
    );
  })
  .listen(PORT, () => {
    console.log('mock...', PORT)
  });

